﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Automobile.service.Model;
using Automobile.service.BLL;

namespace Automobile.service.UI
{
    public partial class BlitemShow : System.Web.UI.Page
    {
        StockBLL bll = new StockBLL();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                StockLoad();
                Session["count"] = bll.Count();
            }
        }
        public void StockLoad()
        {
            this.AspNetPager1.PageSize = 4;
            this.AspNetPager1.RecordCount = bll.Count();
            this.Repeater1.DataSource = bll.ShowStock(this.AspNetPager1.CurrentPageIndex, 4);
            this.Repeater1.DataBind();
        }

        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {

            StockLoad();
        }

        protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            string eName = e.CommandName;
            string Bid = e.CommandArgument.ToString();
            switch (eName)
            {
                
                case "Upt":
                    Response.Redirect("BlitemPandian.aspx?id=" + Bid);
                    break;
            }
        }

        protected void Unnamed_ServerClick(object sender, EventArgs e)
        {
            
            this.AspNetPager1.RecordCount = bll.Count();
            this.Repeater1.DataSource = bll.ShowStock_kucun(this.AspNetPager1.CurrentPageIndex, 4,this.Product_Name.Value);
            this.Repeater1.DataBind();
            this.AspNetPager1.PageSize = 4;
        }
    }
}